package co.fitstart.admin.dao;

import java.util.Date;
import java.util.List;

import com.demo2do.core.persistence.annotation.Dynamic;
import com.demo2do.core.persistence.annotation.Limit;
import com.demo2do.core.persistence.annotation.Query;
import com.demo2do.core.persistence.annotation.Variable;

import co.fitstart.entity.site.Site;
import co.fitstart.entity.user.VisitorRecord;

@Dynamic("hibernate")
public interface VisitorRecordDao {
    
    /**
     * 
     * @param date
     * @param beginIndex
     * @param maxResult
     * @return
     */
    @Limit
    @Query("FROM VisitorRecord WHERE disabled = false AND occurDate = :date")
    public List<VisitorRecord> list(@Variable("date") Date date, @Variable("beginIndex") int beginIndex, @Variable("maxResult") int maxResult);

    /**
     * 
     * @param site
     * @param date
     * @param beginIndex
     * @param maxResult
     * @return
     */
    @Limit
    @Query("FROM VisitorRecord WHERE disabled = false AND site = :site AND occurDate = :date")
    public List<VisitorRecord> list(@Variable("site") Site site, @Variable("date") Date date, @Variable("beginIndex") int beginIndex, @Variable("maxResult") int maxResult);

    /**
     * 
     * @param sites
     * @param date
     * @param beginIndex
     * @param maxResult
     * @return
     */
    @Limit
    @Query("FROM VisitorRecord WHERE disabled = false AND site IN (:sites) AND occurDate = :date")
    public List<VisitorRecord> list(@Variable("sites") List<Site> sites, @Variable("date") Date date, @Variable("beginIndex") int beginIndex, @Variable("maxResult") int maxResult);
}
